package org.nepu.scr.indexrate.converter.riskrate.equipmentdata.drillingdevice;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.riskrate.equipmentdata.drillingdevice.DangerGoodsStorageAreaMap;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class DangerGoodsStorageAreaMapConverter implements AttributeConverter<DangerGoodsStorageAreaMap, String> {
    @Override
    public String convertToDatabaseColumn(DangerGoodsStorageAreaMap dangerGoodsStorageAreaMap) {
        return JSONUtil.toJsonStr(dangerGoodsStorageAreaMap);
    }

    @Override
    public DangerGoodsStorageAreaMap convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, DangerGoodsStorageAreaMap.class);
    }
}
